<template>
  <el-button class="mb5" style="margin-top: -20px;position: absolute;right: 20px;" type="primary"
             @click="initOpen(props.visitId,props.patientId)">
    <template #icon>
      <i-ep-search/>
    </template>
    刷新
  </el-button>
  <el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
    <el-divider content-position="left"><span class="divider-css">▶基本信息◀</span>
    </el-divider>
    <el-row :gutter="10">
      <el-col :span="5">
        <el-form-item label="患者姓名" prop="name">
          <span class="ys-css">{{ form.name }}</span>
        </el-form-item>
      </el-col>
      <el-col :span="7">
        <el-form-item label="身份证号" prop="idNo">
          <el-input v-model="form.idNo" clearable placeholder="请输入身份证号" @blur="certificateNoBlur"/>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="性别" prop="sex">
          <el-select v-model="form.sex" placeholder="请选择性别">
            <el-option v-for="dict in dictDataMap['sys_user_sex']" :key="dict.dictValue"
                       :label="dict.dictLabel"
                       :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item v-if="form.newbornFlag === 'N'" label="职业" prop="occupation">
          <el-select v-model="form.occupation" placeholder="请选择职业" style="width: 100%;">
            <el-option v-for="dict in dictDataMap['profession_dict']" :key="dict.dictValue"
                       :label="dict.dictLabel"
                       :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item v-else label="出生日期" prop="birthdayDate">
          <el-date-picker v-model="form.birthdayDate" clearable placeholder="请选择生日" type="date"
                          value-format="YYYY-MM-DD" @change="birthdayDateChange">
          </el-date-picker>
        </el-form-item>
      </el-col>
      <el-col :span="18">
        <el-row>
          <el-col :span="7" class="age-margin">
            <el-form-item label="年龄" prop="age">
              <el-input ref="ageRef" v-model="form.age" class="age" clearable placeholder="岁">
                <template #append>岁</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7" class="age-margin">
            <el-form-item prop="ageMonth">
              <el-input v-model="form.ageMonth" class="age" clearable placeholder="月">
                <template #append>月</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7" class="age-margin">
            <el-form-item prop="ageDay">
              <el-input v-model="form.ageDay" class="age" clearable placeholder="天">
                <template #append>天</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="5" class="age-margin">
            <el-button plain style="position: absolute;right: 150px;" type="primary" @click="resetAge">
              清空
            </el-button>
          </el-col>
        </el-row>
      </el-col>
      <el-col :span="6">
        <el-form-item label="国籍" prop="nationality">
          <el-select v-model="form.nationality" placeholder="请选择国籍" style="width: 100%;">
            <el-option v-for="dict in dictDataMap['nationality_dict']" :key="dict.dictValue"
                       :label="dict.dictLabel"
                       :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="10">
      <el-col :span="6">
        <el-form-item label="民族" prop="nation">
          <el-select v-model="form.nation" placeholder="请选择民族" style="width: 100%;">
            <el-option v-for="dict in dictDataMap['nation_dict']" :key="dict.dictValue"
                       :label="dict.dictLabel"
                       :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="婚姻" prop="marriage">
          <el-select v-model="form.marriage" placeholder="请选择婚姻" style="width: 100%;">
            <el-option v-for="dict in dictDataMap['marriage_dict']" :key="dict.dictValue"
                       :label="dict.dictLabel"
                       :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="电话" prop="phone">
          <el-input v-model="form.phone" clearable placeholder="请输入电话"/>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="文化程度" prop="eduLevel">
          <el-select v-model="form.eduLevel" placeholder="请选择文化程度" style="width: 100%;">
            <el-option v-for="dict in dictDataMap['education_dict']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="10">
      <el-col :span="18">
        <el-form-item label="籍贯" prop="nativePlace">
          <level-address :value="form.nativePlaceCode" style="width: 35%;"
                         @handleChange="handleChangeNativePlaceCode"/>
          <el-input v-model="form.nativePlace" clearable placeholder="请输入籍贯" style="width: 65%;"/>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="工作单位" prop="workContract">
          <el-input v-model="form.workContract" placeholder="请输入工作单位"/>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="18">
        <el-form-item label="户口地址" prop="registAddress">
          <level-address :value="form.registAddressCode" style="width: 35%;"
                         @handleChange="handleChangeRegistAddressCode"/>
          <el-input v-model="form.registAddress" auto-complete="" clearable
                    placeholder="请输入户口地址" style="width: 65%;"/>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="工作单位电话" prop="workPhone">
          <el-input v-model="form.workPhone" placeholder="请输入工作单位电话"/>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="18">
        <el-form-item label="现住址" prop="address">
          <level-address :value="form.addressCode" style="width: 35%;"
                         @handleChange="handleChangeAddressCode"/>
          <el-input v-model="form.address" auto-complete="" clearable placeholder="请输入户口地址"
                    style="width: 65%;"/>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="邮编" prop="zipCode">
          <el-input v-model="form.zipCode" clearable placeholder="请输入邮编"/>
        </el-form-item>
      </el-col>
    </el-row>
    <el-divider content-position="left" style="margin-top: -5px;"><span class="divider-css">▶入院信息◀</span>
    </el-divider>
    <el-row>
      <el-col :span="6">
        <el-form-item label="入院途径" prop="channel">
          <el-select v-model="form.channel" placeholder="请选择入院途径">
            <el-option v-for="dict in dictDataMap['patient_class_dict']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="入院情况" prop="hospitalSituation">
          <el-select v-model="form.hospitalSituation" placeholder="请选择入院情况">
            <el-option v-for="dict in dictDataMap['admission_situation_dict']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <!-- </el-row>
  <el-row> -->
      <el-col :span="6">
        <el-form-item label="入院科室" prop="deptAdmissionTo">
          <dept-list v-model="form.deptAdmissionTo" :clinic-vs-visit-str="'1,2'" :dept-id="form.deptAdmissionTo"
                     :disabled="true"
                     :org-id="userInfo.orgId" :placeholder="'请选择入院科室'" style="width: 100%"
          />
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="入院病区" prop="wardAdmissionTo">
          <dept-vs-bed-list v-model="form.wardAdmissionToName" :clinical-sign-str="'3'"
                            :dept-id="form.wardAdmissionTo" :disabled="true"
                            :org-id="userInfo.orgId" :placeholder="'请选择入院病区'"
                            style="width: 100%"/>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <!--            <el-col :span="12">-->
      <!--                <el-form-item label="门诊诊断" prop="diagnosis">-->
      <!--                    <el-input v-model="form.clinicDiagnosis"/>-->
      <!--                </el-form-item>-->
      <!--            </el-col>-->
      <el-col :span="6">
        <el-form-item label="隔离情况">
          <el-select v-model="form.quarantine" clearable placeholder="请选择隔离情况">
            <el-option v-for="dict in dictDataMap['sys_yes_no']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="住院次数">
          {{ form.hospitalizationNumber ? form.hospitalizationNumber + "次" : "暂无" }}
        </el-form-item>
      </el-col>
    </el-row>
    <el-divider content-position="left" style="margin-top: 5px;"><span
      class="divider-css">▶医保信息◀</span></el-divider>
    <el-row>
      <el-col :span="8">
        <el-form-item label="费别" prop="chargeType">
          <el-select v-model="form.chargeType" placeholder="请选择费别">
            <el-option v-for="dict in dictDataMap['medical_insurance_type']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="医疗类别" prop="canBaoType">
          <el-select v-model="form.canBaoType" placeholder="请选择参保类型">
            <el-option v-for="dict in dictDataMap['insurance_type']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="医保编号" prop="yiBaoNumber">
          {{ form.yiBaoNumber ? form.yiBaoNumber : "暂无" }}
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="8">
        <el-form-item label="医保诊断" prop="yiBaoDiagnosis">
          <el-input v-model="form.yiBaoDiagnosis"/>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="是否外伤" prop="isTrauma">
          <el-select v-model="form.isTrauma" clearable placeholder="请选择是否外伤">
            <el-option v-for="dict in dictDataMap['sys_yes_no']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="医保卡号" prop="yiBaoCardCode">
          {{ form.yiBaoCardCode ? form.yiBaoCardCode : "暂无" }}
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="8">
        <el-form-item label="生育类别" prop="birthCategory">
          <el-input v-model="form.birthCategory"/>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="是否晚育" prop="isLatebirthFlag">
          <el-select v-model="form.isLateBirthFlag" clearable placeholder="请选择是否晚育">
            <el-option v-for="dict in dictDataMap['sys_yes_no']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="是否早产" prop="isPrematureDelivery">
          <el-select v-model="form.isPrematureDelivery" clearable placeholder="请选择是否早产">
            <el-option v-for="dict in dictDataMap['sys_yes_no']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="8">
        <el-form-item label="孕周数" prop="gesoVal">
          <el-input v-model="form.gesoVal" placeholder="请输入孕周数"/>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="胎儿数" prop="fetusCnt">
          <el-input v-model="form.fetusCnt" placeholder="请输入胎儿数" type="number"/>
        </el-form-item>
      </el-col>
      <el-col :span="8"></el-col>
    </el-row>
    <el-divider content-position="left" style="margin-top: 5px;"><span
      class="divider-css">▶联系人信息◀</span></el-divider>
    <el-row>
      <el-col :span="8">
        <el-form-item label="联系人" prop="contacts">
          <el-input v-model="form.contacts" placeholder="请输入联系人"/>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="联系人电话" prop="contactsPhone">
          <el-input v-model="form.contactsPhone" placeholder="请输入联系人电话"/>
        </el-form-item>
      </el-col>
      <el-col :span="8">
        <el-form-item label="联系人关系" prop="contactsRelation">
          <el-select v-model="form.contactsRelation" placeholder="请选择联系人关系">
            <el-option v-for="dict in dictDataMap['relationship_dict']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="8">
        <el-form-item label="联系人身份证号" prop="contactsIdNo">
          <el-input v-model="form.contactsIdNo" placeholder="请输入联系人身份证号"/>
        </el-form-item>
      </el-col>
      <el-col :span="16">
        <el-form-item label="联系人地址" prop="contactsAddress">
          <level-address :value="form.contactsAddressCode" style="width: 35%;"
                         @handleChange="handleChangeContactsAddressCode"/>
          <el-input v-model="form.contactsAddress" placeholder="请输入联系人地址" style="width: 65%;"/>
        </el-form-item>
      </el-col>
    </el-row>
    <el-divider content-position="left" style="margin-top: -5px;"><span class="divider-css">▶其他信息◀</span>
    </el-divider>
    <el-row>
      <el-col :span="6">
        <el-form-item label="ABO血型" prop="abo">
          <el-select v-model="form.abo" placeholder="请选择ABO血型">
            <el-option v-for="dict in dictDataMap['abo_blood_type']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="RH血型" prop="rh">
          <el-select v-model="form.rh" placeholder="请选择RH血型">
            <el-option v-for="dict in dictDataMap['rh_blood_type']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="离院方式" prop="livHosType">
          <el-select v-model="form.livHosType" placeholder="请选择离院方式">
            <el-option v-for="dict in dictDataMap['leaving_the_hospital_type']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="转科科室" prop="chanceDeptName">
          <el-input v-model="form.chanceDeptName" disabled placeholder="请输入转科科室"/>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="病理号" prop="pathologicalNo">
          <el-input v-model="form.pathologicalNo" placeholder="请输入病理号"/>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="质控医师" prop="qualityDoctor">
          <el-select v-model="form.qualityDoctor" placeholder="请选择">
            <el-option v-for="item in orgVsUserList" :key="item.userId" :label="item.nickName"
                       :value="item.userId"/>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="病案质量" prop="medicalQuality">
          <el-select v-model="form.medicalQuality" placeholder="请选择病案质量">
            <el-option v-for="dict in dictDataMap['medical_record_quality_type']" :key="dict.dictValue"
                       :label="dict.dictLabel" :value="dict.dictValue"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6">
        <el-form-item label="质控时间" prop="qualityTime">
          <el-date-picker v-model="form.qualityTime" clearable placeholder="请选择质控时间" type="datetime"
                          value-format="YYYY-MM-DD HH:mm:ss">
          </el-date-picker>
        </el-form-item>
      </el-col>
      <el-form-item label="颅脑损伤患者昏迷时间" label-width="160">
        <el-col :span="24" class="mb5">
          <el-form-item label="入院前">
            <el-row>
              <el-col :span="8">
                <el-input v-model="form.brainDamageTimeBeforeDay" max="24" min="1"
                          placeholder="请输入天" type="number">
                  <template #append>
                    天
                  </template>
                </el-input>
              </el-col>
              <el-col :span="8">
                <el-input v-model="form.brainDamageTimeBeforeHour" max="59" min="1"
                          placeholder="请输入小时" type="number">
                  <template #append>
                    小时
                  </template>
                </el-input>
              </el-col>
              <el-col :span="8">
                <el-input v-model="form.brainDamageTimeBeforeMinute" max="59" min="1"
                          placeholder="请输入分钟" type="number">
                  <template #append>
                    分钟
                  </template>
                </el-input>
              </el-col>
            </el-row>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="入院后">
            <el-row>
              <el-col :span="8">
                <el-input v-model="form.brainDamageTimeAfterDay" :max="24" min="1"
                          placeholder="请输入天" type="number">
                  <template #append>
                    天
                  </template>
                </el-input>
              </el-col>
              <el-col :span="8">
                <el-input v-model="form.brainDamageTimeAfterHour" :max="59" min="1"
                          placeholder="请输入小时" type="number">
                  <template #append>
                    小时
                  </template>
                </el-input>
              </el-col>
              <el-col :span="8">
                <el-input v-model="form.brainDamageTimeAfterMinute" max="59" min="1"
                          placeholder="请输入分钟" type="number">
                  <template #append>
                    分钟
                  </template>
                </el-input>
              </el-col>
            </el-row>
          </el-form-item>
        </el-col>
      </el-form-item>
      <el-col :span="24">
        <el-form-item label="是否过敏" label-width="160">
          <el-radio-group v-model="form.isDrugAllerge">
            <el-radio v-for="(item, index) in dictDataMap['sys_yes_no']" :key="index"
                      :value="item.dictValue"
                      border>
              {{ item.dictLabel }}
            </el-radio>
          </el-radio-group>
          <el-row class="ml20">
            <el-col :span="24">
              <el-input v-model="form.drugAllergy" :disabled="form.isDrugAllerge !== 'Y'"
                        placeholder="请输入过敏物"/>
            </el-col>
          </el-row>
        </el-form-item>
      </el-col>
      <el-form-item label="是否有出院31天再住院计划" label-width="160">
        <el-radio-group v-model="form.comeAgainIf">
          <el-radio v-for="(item, index) in dictDataMap['sys_yes_no']" :key="index"
                    :value="item.dictValue"
                    border>
            {{ item.dictLabel }}
          </el-radio>
        </el-radio-group>
        <el-row class="ml20">
          <el-col :span="24">
            <el-input v-model="form.comeAgainPurpose" :disabled="form.comeAgainIf !== 'Y'"
                      placeholder="请输入住院目的"/>
          </el-col>
        </el-row>
      </el-form-item>
    </el-row>
  </el-form>
</template>

<script lang="ts" setup>
import {useUserStoreHook} from "@/store/modules/user";
import {useDictStoreHook} from "@/store/modules/dict";
import {getOrgVsUserList} from "@/api/system/user.ts";
import {doctorUpdatePatVisit, listBedRecAndPatientDoctor} from '@/api/hospitalization/patVisit';

const useUserStore = useUserStoreHook();
const dictStore = useDictStoreHook();
let dictDataMap = ref(dictStore.isTypeGetData('profession_dict', 'nationality_dict', 'relationship_dict',
  'medical_insurance_type', 'insurance_type', 'sys_yes_no', 'sys_user_sex', 'nation_dict', 'pay_way_dict', 'marriage_dict', 'education_dict',
  'admission_situation_dict', 'patient_class_dict', 'abo_blood_type', 'rh_blood_type', 'leaving_the_hospital_type', 'medical_record_quality_type'))
const form = ref<any>({
  isDrugAllerge: 'N',
  comeAgainIf: 'N',
})
const emits = defineEmits(["saveOk"])
const {proxy} = getCurrentInstance() as any;
// 登录用户信息
const userInfo = <UserInfoBusi>useUserStore.user.userInfo;

const formRef = ref()
const props = defineProps({
  visitId: {
    type: String,
    default: ""
  },
  patientId: {
    type: String,
    default: ""
  },
  orgId: {
    type: String,
    default: ""
  }
})


const rules = ref({
  idNo: [
    {required: true, message: "身份证号不能为空", trigger: "blur"}
  ]
})
// 选中可是下用户list
const orgVsUserList = ref<any>([])
const currentSelectDept = proxy.$currentSelectDept

function getOrgVsUserListFun() {
  getOrgVsUserList({deptId: currentSelectDept}).then((res: resType) => {
    orgVsUserList.value = res.data
  })
}

getOrgVsUserListFun()


function initOpen(visitId, patientId) {
  const param = {
    visitId: visitId,
    patientId: patientId,
    orgId: props.orgId
  }
  listBedRecAndPatientDoctor(param).then((res: resType) => {
    if (res.data) {
      form.value = res.data[0]
      // let patPrepaymentSumThis = 0 as number
      // if (showParams.value.patPrepaymentVos) {
      //     showParams.value.patPrepaymentVos.forEach((patPrepayment: any) => {
      //         patPrepaymentSumThis += Number(patPrepayment.amountOfMoney)
      //     })
      //     showParams.value.patPrepaymentSum = patPrepaymentSumThis
      // }
      // showParams.value.expensesIncurred = showParams.value.patPrepaymentSum - showParams.value.expensesIncurred
    }
  })
}

function savePatientInfo() {
  (formRef.value as any).validate(valid => {
    if (valid) {
      ElMessageBox.confirm("确认要保存患者信息吗", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        doctorUpdatePatVisit(form.value).then(() => {
          // emits("saveOk")
          ElMessage.success("患者信息保存成功")
        })
      }).catch(() => {
        ElMessage.info("取消操作");
        emits("saveOk")
      });
    }
  })
}

// 年龄组清空
function resetAge() {
  form.value.age = 0
  form.value.ageMonth = 0
  form.value.ageDay = 0
  form.value.ageHours = 0
  form.value.ageMinutes = 0
}

// 身份证获取患者性别、出生年月日、年龄
function certificateNoBlur() {
  if (form.value.certificateType === "0") {
    const idNo = form.value.idNo;
    // 获取性别
    form.value.sex = proxy.$certificateNoInSex(idNo);
    // 获取出生年月日
    const birthday = proxy.$certificateNoInBirthday(idNo);
    form.value.birthdayDate = birthday;
    // 获取年龄 返回年月日小时对象
    const ageObj = proxy.$certificateNoInAge(birthday);
    if (ageObj) {
      form.value.age = ageObj.yStr;
      form.value.ageMonth = ageObj.mStr;
      form.value.ageDay = ageObj.dStr;
      form.value.ageHours = ageObj.hStr;
    }
  }
}

/**
 * 根据出生日期获取年龄
 */
function birthdayDateChange() {
// 获取年龄 返回年月日小时对象
  const ageObj = proxy.$certificateNoInAge(form.value.birthdayDate);
  if (ageObj) {
    form.value.age = ageObj.yStr;
    form.value.ageMonth = ageObj.mStr;
    form.value.ageDay = ageObj.dStr;
    form.value.ageHours = ageObj.hStr;
  }
}

/** 重置按钮操作 */
function empty() {
  form.value.age = 0
  form.value.ageMonth = 0
  form.value.ageDay = 0
  form.value.ageHours = 0
  form.value.ageMinutes = 0
  form.value.name = ""
  form.value.idNo = ""
  form.value.sex = ""
  form.value.newbornFlag = "N"
  form.value.occupation = ""
  form.value.birthdayDate = ""
  form.value.nationality = ""
  form.value.nation = ""
  form.value.marriage = ""
  form.value.phone = ""
  form.value.eduLevel = ""
  form.value.nativePlaceCode = ""
  form.value.nativePlace = ""
  form.value.workContract = ""
  form.value.registAddressCode = ""
  form.value.registAddress = ""
  form.value.workPhone = ""
  form.value.addressCode = ""
  form.value.address = ""
  form.value.zipCode = ""
  form.value.channel = ""
  form.value.hospitalSituation = ""
  form.value.deptAdmissionTo = ""
  form.value.wardAdmissionToName = ""
  form.value.wardAdmissionTo = ""
  form.value.quarantine = ""
  form.value.hospitalizationNumber = ""
  form.value.chargeType = ""
  form.value.canBaoType = ""
  form.value.yiBaoNumber = ""
  form.value.yiBaoDiagnosis = ""
  form.value.isTrauma = ""
  form.value.yiBaoCardCode = ""
  form.value.birthCategory = ""
  form.value.isLateBirthFlag = ""
  form.value.isPrematureDelivery = ""
  form.value.gesoVal = ""
  form.value.fetusCnt = ""
  form.value.contacts = ""
  form.value.contactsPhone = ""
  form.value.contactsRelation = ""
  form.value.contactsIdNo = ""
  form.value.contactsAddressCode = ""
  form.value.contactsAddress = ""
  form.value.abo = ""
  form.value.rh = ""
  form.value.livHosType = ""
  form.value.chanceDeptName = ""
  form.value.pathologicalNo = ""
  form.value.qualityDoctor = ""
  form.value.medicalQuality = ""
  form.value.qualityTime = ""
  form.value.brainDamageTimeBeforeDay = ""
  form.value.brainDamageTimeBeforeHour = ""
  form.value.brainDamageTimeBeforeMinute = ""
  form.value.brainDamageTimeAfterDay = ""
  form.value.brainDamageTimeAfterHour = ""
  form.value.brainDamageTimeAfterMinute = ""
  form.value.isDrugAllerge = ""
  form.value.comeAgainIf = "Y"
  form.value.comeAgainPurpose = ""
}

defineExpose({
  initOpen,
  savePatientInfo,
  empty
})
</script>

<style scoped>
.age-margin {
  margin-right: -95px;
}
</style>
